All FaceWare modules are shipped with "example" or "demo" programs that illustrate use of the modules. These programs have a one- or two- letter prefix that designates the associated module: "vDemoXY" illustrates use of ViewIt, "drDemoXY" of DrawIt, "anDemoXY" of AnimIt, etc. ("XY" is a compiler designation defined in the "About Compilers" program). Most such demo programs are quite small (2-4 pages) due to their use of FaceIt & ViewIt to automatically handle most menu and window events, and therefore make a good starting point for new projects.
Before you explore the vDemoXY (ViewIt) and fDemoXY (FaceIt) demo programs, it is helpful to examine a program that represents the minimum amount of code necessary to open a ViewIt window in a FaceIt-based program. This code is presented below for the 3 major languages supported:
• Pascal
uses FaceStorLP, FaceProcLP; {C1}
begin
fRec.uName := 'Minimum.Rsrc'; {C2}
FaceIt(nil,DoInit,0,0,0,0); {C3}
FaceIt(nil,NewWnd,1000,1,0,0);
repeat
FaceIt(nil,DoLoop,0,0,0,0); {C4}
if (fRec.uMenuID = 1000) then
...
until false;
end.
• C
#include "FaceStorLC.h" /*C1*/
main()
{
strcpy(fRec.uName,"Minimum.Rsrc"); /*C2*/
FaceIt(0L,DoInit,0L,0L,0L,0L); /*C3*/
FaceIt(0L,NewWnd,1000L,1L,0L,0L);
for (;;)
{
FaceIt(0L,DoLoop,0L,0L,0L,0L); /*C4*/
if (fRec.uMenuID == 1000)
...
}
}
• Fortran
include FaceStorLF.inc !C1
record /FaceRec/ fRec
common/FaceStuff/fRec
fRec.uName = 'Minimum.Rsrc' !C2
FaceIt(0,DoInit,0,0,0,0) !C3
FaceIt(0,NewWnd,1000,1,0,0)
do while (.true.)
FaceIt(0,DoLoop,0,0,0,0) !C4
if (fRec.uMenuID = 1000) then
...
end do
end
The "C#" comments refer to later help topics that describe what the associated code is doing:
C1 = see Include Files topic
C2 = see Resource Files topic
C3 = see Initializations topic
C4 = see Event Handling topic
Please take the time to read these topics so that you have a good idea why FaceIt-based programs are built around these four elements.